package utils.cli;

import exceptions.CliException;

import java.util.HashMap;
import java.util.Map;

public class Options {
    /**
     * 从短选项到长选项的映射，权限应设置为友好
     */
    Map<String, Option> optionsMap = new HashMap<>();
    /**
     * 从长选项到短选项的映射，权限应设置为友好
     */
    Map<String, String> longShortMap = new HashMap<>();

    public void addOption(String shortOption, String longOption, boolean hasVal) {
        if (shortOption == null) throw new CliException();
        optionsMap.put(shortOption, new Option(longOption, hasVal));
        if (longOption != null) {
            longShortMap.put(longOption, shortOption);
        }
    }

    static class Option {
        String longOption;
        boolean hasVal;
        Option(String longOption, boolean hasVal) {
            this.longOption = longOption;
            this.hasVal = hasVal;
        }
    }

}



